package com.xiaoshuidi.cloud.module.contract.enums.contract;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 业主合同状态的枚举类
 * private String contractStatus;
 *
 * @author 合房源码
 */
@Getter
@AllArgsConstructor
public enum ContractOwnerShowStatusEnum {
    PENDING_APPROVAL("pending", "待审批"),
    NO_SIGNED("no_signed", "待签约"),
    REJECT("reject", "已驳回"),
    WAITING_ACTIVE("waiting_active", "续租待生效"),
    ACTIVE("active", "已生效"),
    ENDED("normal_end", "已结束"),
    RENTING_OUT("renting_out", "已退租"),
    CANCELED("canceled", "已取消"),
    PLATFORM_NO_SIGNED("platform_no_signed", "待签约（平台待签约）"),
    OWNER_NO_SIGNED("owner_no_signed", "待签约（业主待签约）"),
    EXPIRED("expired", "已到期")

    ;
    //编码
    private final String code;
    //信息
    private final String msg;

    public static ContractOwnerShowStatusEnum getContractStatusEnumByCode(String code) {
        for (ContractOwnerShowStatusEnum contractStatusEnum : values()) {
            if (contractStatusEnum.code.equals(code)) {
                return contractStatusEnum;
            }
        }
        return null;
    }

    public static String getName(String code) {
        for (ContractOwnerShowStatusEnum c : ContractOwnerShowStatusEnum.values()) {
            if (c.getCode().equals(code)) {
                return c.msg;
            }
        }
        return null;
    }

}
